
package aliasMatching.controller;

import com.sun.java.swing.Painter;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author amendrashrestha
 *
 * Here, the colored progress bar is created.
 *
 */
public class ProgressCellRenderer extends JProgressBar implements TableCellRenderer {

    public ProgressCellRenderer() {
        super(JProgressBar.HORIZONTAL);
        setBorderPainted(true);
        setStringPainted(true);
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        if(value instanceof Float){
            setBackground(table.getBackground());
            float i = ((Float)value).floatValue();
            setValue((int) i);
        }
        return this;
    }
}
